package daily.may0514;

public class StringHashCodeTest {
    public static void main(String[] args) {
        String s1 = new String("张三李四");
        String s2 = new String("王五赵六");
        String s3 = new String("张三李四");
        //String类重写Obejct类的hashCode方法
        //可以看到s1和s3字符串相同，哈希值也相同，
        System.out.println(s1.hashCode());//745510390
        System.out.println(s2.hashCode());//901662913
        System.out.println(s3.hashCode());//745510390
        System.out.println(s3.hashCode() == s1.hashCode());//true
        //相同的字符串，哈希值相同
        System.out.println("田七".hashCode());//949971
        System.out.println("田七".hashCode());//949971
        System.out.println("2233".hashCode());//1539232
    }
}
